package com.yourname.myapplication.data.room.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.yourname.myapplication.data.model.FavoriteQuestion
import com.yourname.myapplication.data.model.Question
import kotlinx.coroutines.flow.Flow

@Dao
interface FavoriteQuestionDao {
    @Insert
    suspend fun insert(favoriteQuestion: FavoriteQuestion)

    @Query("SELECT q.* FROM favorite_questions fq JOIN questions q ON fq.questionId = q.id WHERE fq.userId = :userId")
    fun getFavoriteQuestionsByUserId(userId: Int): Flow<List<Question>>
}